class Solution
{
public:
    int minOperations(int k)
    {
        int result = INT_MAX;
        for (int addCount = 0; addCount < k; ++addCount)
        {
            int mulCount = k / (addCount + 1) + (k % (addCount + 1) > 0) - 1;
            result = min(result, addCount + mulCount);
        }
        return result;
    }
};